//
//  LoginNetRequest.m
//  quhuolang
//
//  Created by 曹欣欣 on 2018/3/8.
//  Copyright © 2018年 fusw. All rights reserved.
//

#import "LoginNetRequest.h"

@implementation LoginNetRequest
 

/**
 检查更新
 
 @param parameters 请求参数
 @param responseBlock 返回参数
 */

+ (void)versionUpdateRequest:(NSDictionary *)parameters andBlock:(RequestResultSuccess)responseBlock andFailBlock:(RequestResultFailure)failBlock{
    
  
    [[NetWorkBaseAPIManager manager] requestHttpWithMethod:Get url:[NSString stringWithFormat:@"%@v1/shippers/version",BaseURL] parameters:parameters isJson:NO success:^(id responseObject) {
//        [FSWToast showWithText:responseObject[@"message"]];
        if ([responseObject[@"success"] isEqualToString:@"true"]) {
            responseBlock(responseObject[@"data"][@"need_updated"]);
        }else{
            failBlock(@"");
        }
        
    } failure:^(NSString *errorDesc) {
        failBlock(errorDesc);
    }];
}


/**
 发送验证码
 
 @param parameters 请求参数
 @param responseBlock 返回参数
 */

+ (void)sendCodeDataRequest:(NSDictionary *)parameters andBlock:(RequestResultSuccess)responseBlock andFailBlock:(RequestResultFailure)failBlock{
    [SVProgressHUD show];
   
    [[NetWorkBaseAPIManager manager] requestHttpWithMethod:Get url: [KRequesetLinkUrl getUrlByKey:SEND_CODE] parameters:parameters isJson:YES success:^(id responseObject) {
        NSInteger code = [responseObject[@"code"] integerValue] ;
        if (code == 200) {
            responseBlock(nil);
        }else{
            NSString *msg = responseObject[@"msg"] ;
            failBlock(msg);
        }
    } failure:^(NSString *errorDesc) {
   
        failBlock(errorDesc);
    }];
}

/**
 忘记密码-修改密码
 
 @param parameters 请求参数
 @param responseBlock 返回参数
 */

+ (void)forgetPwdDataRequest:(NSDictionary *)parameters andBlock:(RequestResultSuccess)responseBlock andFailBlock:(RequestResultFailure)failBlock{
    [SVProgressHUD show];
   
    [[NetWorkBaseAPIManager manager] requestHttpWithMethod:Get url: [KRequesetLinkUrl getUrlByKey:FORGET_PWD] parameters:parameters isJson:YES success:^(id responseObject) {
        NSInteger code = [responseObject[@"code"] integerValue] ;
        if (code == 200) {
            responseBlock(nil);
        }else{
            NSString *msg = responseObject[@"msg"] ;
            failBlock(msg);
        }
    } failure:^(NSString *errorDesc) {
   
        failBlock(@"修改失败");
    }];
}
@end

